package com.example.jdbcsamples.program;

import java.util.List;

import javax.swing.JOptionPane;

import com.example.jdbcsamples.entity.Department;
import com.example.jdbcsamples.model.DbUtil;

/**
 * 
 * @author Bora SAYINER
 * @since Feb 1, 2015 10:33:23 AM
 * @version 1.0.0
 */
public class Driver {

	public static void main(String[] args) {
		// List<Department> departments = DbUtil.getAllDepartments();
		// for (Department department : departments) {
		// System.out.println(department);
		// }
		
//		Department department = new Department();
//		department.setNumber(20);
//		department.setName("Java Programming");
//		boolean result = DbUtil.insertDeparment(department);
//		if (result) {
//			JOptionPane.showMessageDialog(null, "Kayıt başarıyla eklendi");
//		}else {
//			JOptionPane.showMessageDialog(null, "Kayıt eklenemedi");
//		}
		
//		Department department = DbUtil.findDepartmentById(20);
//		System.out.println(department);
//		department.setName("POJO Dep");
//		DbUtil.updateDeparment(department);
//		department = DbUtil.findDepartmentById(20);
//		System.out.println(department);
		
		Department department = DbUtil.findDepartmentById(20);
		boolean result = DbUtil.deleteDeparment(department);
		System.out.println(result);
		
	}

}
